std::priority_queue::top
From Cppreference
< cpp | container | priority queue
| C++ Standard Library | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||||||||||||||||||||||||||||
| Containers library | ||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||
| std::priority_queue | ||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||
| reference top();
| ||
| const_reference top() const;
| ||
Returns reference to the top element in the priority queue. This element will be removed on a call to pop(). If default comparison function is used, the returned element is also the greatest among the elements in the queue.
Effectively calls c.back().
Contents |
Parameters
(none)
Return value
reference to the top element
Complexity
constant
See also
| removes the first element (public member function) | |